package com.wanxi.common.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.*;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
@Document(indexName = "company")
//@Setting(shards = 2,replicas = 1)
@ApiModel(value = "公司")
public class CompanyModel {

    @JsonFormat(shape = JsonFormat.Shape.STRING)
    @TableId(type = IdType.ASSIGN_ID)
    @Id
    @ApiModelProperty(value = "公司ID",example = "1111111")
    private Long id;

    @Field(type = FieldType.Text,name = "img_href")
    @ApiModelProperty(value = "公司图片",example = "abc.jpg")
    private String imgHref;

    @Field(analyzer = "ik_max_word",type = FieldType.Text,name = "name")
    @ApiModelProperty(value = "公司名字",example = "成都公司")
    private String name;

    @Field(type = FieldType.Text,name = "english_name")
    @ApiModelProperty(value = "公司英文名字",example = "chengdugongsi")
    private String englishName;

    @Field(analyzer = "ik_max_word",type = FieldType.Text,name = "content")
    @ApiModelProperty(value = "公司内容",example = "成都公司好啊")
    private String content;

    @Field(analyzer = "ik_max_word",type = FieldType.Text,name = "massage")
    @ApiModelProperty(value = "公司短语",example = "成都公司天天都好啊")
    private String massage;

    @ApiModelProperty(value = "查询页数",example = "1")
    private Integer page;

    @ApiModelProperty(value = "查询条数",example = "10")
    private Integer limit;

//    @TableField(fill = FieldFill.INSERT)

    @Field(analyzer = "ik_max_word", type = FieldType.Date, name = "create_time", format = DateFormat.custom, pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "生成时间",example = "2023.07.21")
//    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;
//    @TableField(fill = FieldFill.INSERT_UPDATE)

    @Field(analyzer = "ik_max_word", type = FieldType.Date, name = "update_time", format = DateFormat.custom, pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "更新时间",example = "2023.07.21")
//    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime;

    @Field(type = FieldType.Integer,name = "enable")
    @ApiModelProperty(value = "公司状态",example = "1")
    private Integer enable;

    @Field(type = FieldType.Text,name = "remark")
    private String remark;
}
